<template>
  <div class="mall-header-container">
    <van-nav-bar
      :title="title"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
    <template slot="right">
      <van-icon name="wap-home" size="18" />
    </template>
    </van-nav-bar>
  </div>
</template>

<script>
export default {
  name: 'Header',
  computed: {
    title () {
      return this.$route.meta.name
    }
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    },
    onClickRight () {
      this.$router.push({
        path: '/home'
      })
    }
  }
}
</script>

<style lang="less">
  .mall-header-container {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    width: 100%;
  }
</style>
